package com.cdream.basic.algorithm.leetcode.array;

import java.util.*;

/**
 * @author cdream
 * @date 2022/2/3
 */
public class Question1414 {
    public int findMinFibonacciNumbers(int k) {
        TreeSet<Integer> set = new TreeSet<>();
        List<Integer> list = new ArrayList<>();
        set.add(1);
        list.add(1);
        list.add(1);
        while(list.get(list.size()-1)<k){
            int next = list.get(list.size()-1) + list.get(list.size() - 2);
            list.add(next);
            set.add(next);
        }
        int res = 0;
        while (k!=0){
            Integer ceiling = set.floor(k);
            k-=ceiling;
            res++;
        }
        return res;
    }
    public int sumOfUnique(int[] nums) {
        Map<Integer,Integer> map =  new HashMap<>();
        for(int i : nums){
            map.put(i,map.getOrDefault(i,0)+1);
        }
        int res = 0;
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            Integer k = entry.getKey();
            Integer v = entry.getValue();
            if (v == 1) {
                res += k;
            }
        }
        return res;
    }
    public static void main(String[] args) throws InterruptedException {
        // new Question1414().findMinFibonacciNumbers(7);
        while (true){
            Thread.sleep(5000);
            System.out.println("dog");
        }
    }
}
